import request from "@/utils/request";
import { AxiosPromise } from "axios";
import { PageVO, Query, typeList, addCurriculumForm } from "./types";
/**
 * 获取课程分类列表
 *
 * @param UserQuery
 */
export function getClassPage(
  data: Query
): AxiosPromise<PageVO[]> {
  return request({
    url: "/study/Subject/treeLists",
    method: "post",
    data,
  });
}

/**
 * 获取课程分类顶级列表
 *
 */
export function getCateList(
): AxiosPromise<typeList[]> {
  return request({
    url: "/study/Subject/cateList",
    method: "post",
  });
}

/**
 * 新增修改分类
 *
 */
export function getSubjectkAdd(
  data: any) {
  return request({
    url: "/study/Subject/edit",
    method: "post",
    data,
  });
}

/**
 * 删除课程分类数据
 * 
 * @param data
 */
export function postDelete(
  data: any) {
  return request({
    url: "/study/Subject/delete",
    method: "post",
    data,
  });
}


/**
 *获取素材分类
 *  
 * @param Query
 */

export function getCategoryList(data: any): AxiosPromise<PageVO[]> {
  return request({
    url: "study/SpecialTaskCategory/getCategoryList",
    method: "post",
    data,
  });
}

/**
 * 获取素材分类顶级列表
 *
 */
export function getTaskList(
): AxiosPromise<typeList[]> {
  return request({
    url: "/study/SpecialTaskCategory/cateList",
    method: "post",
  });
}


/**
 * 新增素材分类
 *
*/
export function getTaskAdd(
  data: any) {
  return request({
    url: "/study/SpecialTaskCategory/add",
    method: "post",
    data,
  });
}

/**
 * 修改素材分类
 *
*/
export function getTaskEdit(
  data: any) {
  return request({
    url: "/study/SpecialTaskCategory/edit",
    method: "post",
    data,
  });
}

/**
 * 删除课程分类数据
 * 
 * @param data
 */
export function postTaskDel(
  data: any) {
  return request({
    url: "/study/SpecialTaskCategory/del",
    method: "post",
    data,
  });
}


// 素材列表
export function getSourceList(
  data: Query
): AxiosPromise<PageResult<PageVO[]>> {
  return request({
    url: "/study/SpecialTask/getSourceList",
    method: "post",
    data,
  });
}

//  添加素材
export function saveSource(
  data: addCurriculumForm
) {
  return request({
    url: "/study/SpecialTask/saveSource",
    method: "post",
    data,
  });
}

//  刪除素材列表
export function getTaskDel(
  data: any
) {
  return request({
    url: "/study/SpecialTask/del",
    method: "post",
    data,
  });
}

//  修改素材
export function getSourceEdit(
  data: addCurriculumForm
) {
  return request({
    url: "/study/SpecialTask/edit",
    method: "post",
    data,
  });
}

// 视频列表
export function getVideoList(
  data: Query
): AxiosPromise<PageResult<PageVO[]>> {
  return request({
    url: "/study/SpecialVideo/list",
    method: "post",
    data,
  });
}

//  添加视频
export function postVideoAdd(
  data: addCurriculumForm
) {
  return request({
    url: "/study/SpecialVideo/create",
    method: "post",
    data,
  });
}


// 删除视频
export function postVideoDel(
  data: any
) {
  return request({
    url: "/study/SpecialVideo/del",
    method: "post",
    data,
  });
}

// 修改视频
export function getVideoEdit(
  data: any
) {
  return request({
    url: "/study/SpecialVideo/edit",
    method: "post",
    data,
  });
}


// 上下架视频
export function getVideoShelves(
  data: any
) {
  return request({
    url: "/study/SpecialVideo/shelves",
    method: "post",
    data,
  });
}
